package com.linkoog.devtools.generate.method_creater.actions;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;


public class ControllerMethodActionGroup extends DefaultActionGroup {

    public ControllerMethodActionGroup() {
        super();
    }



    @Override
    public void update(@NotNull AnActionEvent event) {
        // Get the project and action folder
        Project project = event.getProject();
        Editor editor = event.getData(LangDataKeys.EDITOR);
        PsiFile psiFile = event.getData(LangDataKeys.PSI_FILE);

        Presentation presentation = event.getPresentation();
        presentation.setPopupGroup(true);
        if (project != null && editor != null && psiFile != null) {
            presentation.setVisible(true);
        } else {
            presentation.setVisible(false);
        }
    }
}
